<template>
  <div>
    <h1>App</h1>
    {{ users }}

  </div>
</template>
<script>
import axios from 'axios';

// console.log(process.env);
// console.log(process.env.VUE_APP_BASE_URL);

const request = axios.create({
  baseURL: process.env.VUE_APP_BASE_URL,
});
export default {
  data() {
    return {
      users: [],
    };
  },
  created() {
    this.getUsers();
  },
  methods: {
    async getUsers() {
      // 1. http://loaclhost:8080/dev/users
      // 2. http://127.0.0.1:3001/dev/users
      // 3. http://127.0.0.1:3001/users 
      const { data } = await request.get('/users');
      this.users = data;
    }
  }

};
</script>